<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>dssiactivate</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="dripwater.html" title="dripwater" />
    <link rel="next" href="dssiaudio.html" title="dssiaudio" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">dssiactivate</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="dripwater.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="dssiaudio.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="dssiactivate"></a>
      <div class="titlepage"></div>
      <a id="IndexDssiactivate" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">dssiactivate</span>
        </h2>
        <p>dssiactivate — Activates or deactivates a DSSI or LADSPA plugin.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp99941552"></a>
        <h2>Syntax</h2>
        <pre class="synopsis"><span class="command"><strong>dssiactivate</strong></span> ihandle, ktoggle </pre>
      </div>
      <div class="refsect1">
        <a id="idp99983488"></a>
        <h2>Description</h2>
        <p><span class="emphasis"><em>dssiactivate</em></span> is used to activate or deactivate a DSSI or LADSPA plugin. It calles the plugin's activate() and deactivate() functions if they are provided.</p>
      </div>
      <div class="refsect1">
        <a id="idp99985120"></a>
        <h2>Initialization</h2>
        <p><span class="emphasis"><em>ihandle</em></span> - the number which identifies the
      plugin, generated by <a class="link" href="dssiinit.html" title="dssiinit"><em class="citetitle">dssiinit</em></a>.</p>
      </div>
      <div class="refsect1">
        <a id="idp99987520"></a>
        <h2>Performance</h2>
        <p><span class="emphasis"><em>ktoggle</em></span> - Selects between activation (ktoggle=1) and deactivation (ktoggle=0).</p>
        <p>  <span class="emphasis"><em>dssiactivate</em></span> is used to turn on and off plugins if they provide this facility. This may help conserve CPU processing in some cases. For consistency, all plugins must be activated to produce sound. An inactive plugin produces silence.
    </p>
        <p>Depending on the plugin's implementation, this may cause interruptions in the realtime audio process, so use with caution.
    </p>
        <p>
      <span class="emphasis"><em>dssiactivate</em></span> may cause audio stream breakups when used in realtime, so it is recommended to load all plugins to be used before playing.</p>
        <div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
          <table border="0" summary="Warning">
            <tr>
              <td rowspan="2" align="center" valign="top" width="25">
                <img alt="[Warning]" src="images/warning.png" />
              </td>
              <th align="left">Warning</th>
            </tr>
            <tr>
              <td align="left" valign="top">
                <p>Please note that even if activate() and deactivate() functions are not present in a plugin, <span class="emphasis"><em>dssiactivate</em></span> must be called for the plugin to produce sound.</p>
              </td>
            </tr>
          </table>
        </div>
      </div>
      <div class="refsect1">
        <a id="idp99992944"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the dssiactivate opcode. It uses the file <a class="ulink" href="examples/dssiactivate.csd" target="_top"><em class="citetitle">dssiactivate.csd</em></a>.

      </p>
        <div class="example">
          <a id="idp99994816"></a>
          <p class="title">
            <strong>Example 205. Example of the dssiactivate opcode.</strong>
          </p>
          <div class="example-contents">
            <p>See the sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time Audio</em></a> and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line Flags</em></a> for more information on using command line flags.</p>
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
-odac     <span class="comment">;;;RT audio out</span>
<span class="comment">;-iadc    ;;;uncomment -iadc if RT audio input is needed too</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o dssiactivate.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="ohdr">sr</span> <span class="op">=</span> 44100
<span class="ohdr">ksmps</span> <span class="op">=</span> 32
<span class="ohdr">nchnls</span> <span class="op">=</span> 2

gihandle dssiinit "caps.so", 19, 1	<span class="comment">; = mono phaser and</span>
gaout <span class="opc">init</span>  0				<span class="comment">; verbose about all ports</span>

<span class="oblock">instr</span> 1	<span class="comment">; activate DSSI</span>

ktoggle	<span class="op">=</span>  p4
dssiactivate gihandle, ktoggle
<span class="oblock">endin</span>

<span class="oblock">instr</span> 2

ain1	<span class="opc">diskin2</span> "beats.wav", 1,0,1	<span class="comment">; loop</span>
ain1	<span class="op">=</span>	ain1<span class="op">*</span>.5
	<span class="opc">outs</span>	ain1, ain1
gaout <span class="op">=</span> gaout<span class="op">+</span>ain1
<span class="oblock">endin</span>

<span class="oblock">instr</span> 3

dssictls gihandle, 0, 1, 1			<span class="comment">; range -1 to 1</span>
dssictls gihandle, 1, 2, 1			<span class="comment">; rate 0 to 10</span>
dssictls gihandle, 2, .8, 1			<span class="comment">; depth 0 to 1</span>
dssictls gihandle, 3, 3, 1			<span class="comment">; spread 0 to 3.14</span>
dssictls gihandle, 4, .9, 1			<span class="comment">; feedback 0 to 0.999</span>

<span class="oblock">endin</span>

<span class="oblock">instr</span> 4

aout1 dssiaudio gihandle, gaout	<span class="comment">;get beats.wav, mono out</span>
	<span class="opc">outs</span> aout1,aout1

gaout <span class="op">=</span> 0
<span class="oblock">endin</span>

<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>
<span class="stamnt">i</span> 1 0 4 1
<span class="stamnt">i</span> 1 + . 0
<span class="stamnt">i</span> 1 + . 1 
<span class="stamnt">i</span> 1 + . 0
<span class="stamnt">i</span> 1 + . 1
<span class="stamnt">i</span> 2 1 20 
<span class="stamnt">i</span> 3 1 20
<span class="stamnt">i</span> 4 0 20

<span class="stamnt">e</span>
<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
      </div>
      <div class="refsect1">
        <a id="idp99999104"></a>
        <h2>Credits</h2>
        <p>2005</p>
        <p>By: Andrés Cabrera</p>
        <p>Uses code from Richard Furse's LADSPA sdk.</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="dripwater.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="dssiaudio.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">dripwater </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> dssiaudio</td>
        </tr>
      </table>
    </div>
  </body>
</html>
